<html><head>
  <script type="text/javascript">
  var selectedItem = "";
  var resizing = 1;
  var height, width;
  var imgroot = "%ROOT_IMG%";
  var LoadingText = "Loading...";
  var UnavailableText = "Unavailable";
  var SessionID = "%SID%";
  var Target = "%TRG%";
  var ie = (document.all != null);
  var moz = !ie && document.getElementById != null && document.layers == null;
  if (moz) {
    Event.prototype.__defineGetter__("srcElement", function () {
      var node = this.target;
      while (node.nodeType != 1) node = node.parentNode;
      return node;
    });
    Event.prototype.__defineSetter__("returnValue", function (b) {
      if (!b) this.preventDefault();
    });
  }
  </script>
  <script type="text/javascript" src="%ROOT_JAVA%/XMLDoc.js"></script>
  <script type="text/javascript" src="%ROOT_JAVA%/SelectItem.js"></script>
  <script type="text/javascript" src="%ROOT_JAVA%/LoadItem.js"></script>
  <script type="text/javascript" src="%ROOT_JAVA%/ExpandCollapse.js"></script>
  <script type="text/javascript" src="%ROOT_JAVA%/Button.js"></script>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" type="text/css" href="%ROOT_CSS%/style.css">
  
<style>
div.level0 {
	padding-left: 10px;
	padding-top: 5px;
}

div.onto {
	padding-left: 0px;
	padding-top: 5px;
	padding-bottom: 5px;
}

span.notSelected2 {
  margin:  3px;
  border: 1px #ffffff solid;
  padding: 2px;
}
span.selected2 {
  margin:  3px;
  border: 1px #888888 solid;
  padding: 2px;
}
</style>

<script>
var iDomainAndTMO = %DTMO%;
var Domain = 1;

var iSelectedClass = new Array();
iSelectedClass['domain'] = 'undefined';
iSelectedClass['tmo'] = 'undefined';
var iSelectedClassA = new Array();
iSelectedClassA['domain'] = 'undefined';
iSelectedClassA['tmo'] = 'undefined';
function SelectClass (id, aid, type) {
	
	if (typeof iSelectedClassA[type] != 'undefined') {
		$ (iSelectedClassA[type]).className = 'notSelected2';
	}
	
	iSelectedClass[type] = id;
	iSelectedClassA[type] = aid;
	
	$ (iSelectedClassA[type]).className = 'selected2';
}

var iParentId = new Array();
iParentId['domain'] = 0;
iParentId['tmo'] = 0;
var aOpenClosed = new Array();
function SetParentId (id, type) {
	if ($('new'+iParentId[type])) {
		$('new'+iParentId[type]).className = 'notSelected2';
	}
	iParentId[type] = id;
	$('new'+iParentId[type]).className = 'selected2';
}

function sGetOpenClosed () {
	var str = '&';
	for (i in aOpenClosed) {
		str += 'oc['+i+']='+aOpenClosed[i]+'&';
	}
	return str;
}

function AddClass () {
	sUrl = '';
	aType = new Array ('domain', 'tmo');
	for (i in aType) {
		if (typeof iSelectedClass[aType[i]] != 'undefined') {
			sUrl += 'cid['+aType[i]+']='+iSelectedClass[aType[i]]+'&parent_id['+aType[i]+']='+iParentId[aType[i]]+'&';
			iParentId[aType[i]] = 0;
			iSelectedClass[aType[i]] = 'undefined';
		}
	}
	if (sUrl != '') {
		loadXMLFile ('nfo', 'index.php?trg=merger&act=addclass&sid=%SID%&mid=%MID%&'+sUrl+sGetOpenClosed(), 1);
	}
}

function RemoveClass () {
	sUrl = '';
	aType = new Array ('domain', 'tmo');
	for (i in aType) {
		if (iParentId[aType[i]] > 0) {
			if (confirm ('Delete '+aType[i])) {
				sUrl += 'cid['+aType[i]+']='+iParentId[aType[i]]+'&';
			}
		}
	}
	if (sUrl != '') {
		loadXMLFile ('nfo', 'index.php?trg=merger&act=removeclass&sid=%SID%&mid=%MID%&'+sUrl+sGetOpenClosed(), 1);
	}
}

//
function getRequestObject ()
{
	var req = null;
	if (typeof XMLHttpRequest != "undefined")
		req = new XMLHttpRequest();
	if (!req && typeof ActiveXObject != "undefined") {
		try {
			req=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				req=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				try {
					req=new ActiveXObject("Msxml2.XMLHTTP.4.0");
				} catch (e3) {
					req=null;
				}
			}
		}
	}
	if(!req && window.createRequest)
		req = window.createRequest();
	
	return req;
} 
//

function $ (name) {
	return document.getElementById (name);
}

var aTree;
var div_id;
var id;
function CollapseClasses (_div_id, _id) {
	div_id = _div_id;
	id = _id;
	if (document.getElementById (div_id).style.display == "none") {
		
		var bLoaded = false;
		for (key in aTree) {
			if (key == id) {
				bLoaded = true;
				break;
			}
		}
		
		if (!bLoaded) {
			var r = getRequestObject();
			r.onreadystatechange = function() { 
				if (r.readyState != 4) {
					return; 
				}
				
				if (r.status==200) {
					if (r.responseXML.documentElement.firstChild.data) {
						$(div_id).innerHTML = r.responseXML.documentElement.firstChild.data;
						$(div_id).style.display = "block";
					}
					
					window.status = '';
				} else {
					alert (r.status);
					alert (r.responseText);
				}
			}
			
			r.open ("GET", 'index.php?trg=merger&act=subclasses&sid=%SID%&mid=%MID%&parent_class_id='+id, true);
			window.status =  'Please wait...';
			r.send(null);
		}
	} else {
		document.getElementById (div_id).style.display = "none";
	}
}

function DomainOnly () {
	Domain = 1;
	$('iroot2').style.display = 'none';
	$('iroot').style.display = 'block';
	loadXMLFile ("nfo", "index.php?trg=merger&act=viewclasses&sid=%SID%&mid=%MID%&view=domain", 1)
}

function TMOOnly () {
	Domain = 0;
	$('iroot').style.display = 'none';
	$('iroot2').style.display = 'block';
	loadXMLFile ("nfo", "index.php?trg=merger&act=viewclasses&sid=%SID%&mid=%MID%&view=tmo", 1)
}
</script>
  
  <title>Web-DESO 2.0: %MERG%</title>
</head>
<body>
<table class="filled" height="100%" width="100%" border="0" cellspacing="0" cellpadding="5">
  <tr class="head">
    <td align="left"><h1>%MERG%</h1></td>
    <td align="right"><img src="%ROOT_IMG%/logo.gif" alt="logo" /></td>
  </tr>
  <tr class="head">
    <td align="left">
      <a class="topmenu" href="index.php?trg=logout&sid=%SID%"><img border="0" src="%ROOT_IMG%/logout.gif">&nbsp;%LOGOUT%</a>
      <b>&nbsp;|&nbsp;</b>
      <a class="topmenu" href="index.php?trg=main&sid=%SID%"><img border="0" src="%ROOT_IMG%/mainmenu.gif">&nbsp;%MAINMENU%</a>
    </td>
    <td align="right">Developed by SPIIRAS &copy;</td>
  </tr>
  <tr height="90%"><td colspan="2" nowrap>
   <table height="100%" width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
	  <td width="30%" class="subhead">
        <a class="topmenu" href="javascript:AddClass();"><img border="0" src="%ROOT_IMG%/new.gif">&nbsp;Add</a>
      </td>
      <td class="subhead">
      	<a class="topmenu" href="javascript:RemoveClass();"><img border="0" src="%ROOT_IMG%/delete.gif">&nbsp;Delete</a>
      </td>
      <td class="subhead">
      	<a class="topmenu" href="javascript:AddClass();"><img border="0" src="%ROOT_IMG%/new.gif">&nbsp;Add</a>
      </td>
    </tr>     
    <tr>
	    <td rowspan="2" width="30%"><div class="ScrollDiv"> 
        <div id="iroot">
        
        %ONTOTREELEFT%
        
        </div>
      </div></td>
      <td width="36%"><div class="ScrollDiv">
        <div id="info"></div>
      </div></td>     
      <td width="34%">
      
      <div class="ScrollDiv"> 
        <div id="iroot2">
        
        %ONTOTREERIGHT%
        
        </div>
      </div>
      
      
      </td></tr>
    </table>
  </td></tr>
  
  <tr>
  	<td>
  	<br>
		<form method="GET">
  		<input type="hidden" name="sid" value="%SID%">
  		<input type="hidden" name="mid" value="%MID%">
  		<input type="hidden" name="act" value="save">
  		<input type="hidden" name="trg" value="merger">
  		<input type="submit" value="Save!">
  		</form>

  	</td>
  </tr>
  
</table>
<script type="text/javascript">
loadXMLFile ('nfo', 'index.php?trg=merger&act=viewclasses&sid=%SID%&mid=%MID%', 1);
window.onload = function() {
	if (iDomainAndTMO == 1) {$('iroot2').style.display = 'none';}
  document.onkeydown = KeyDown;
}
</script>
</body></html>